/**  
 * @Title:  ThreadPoolConfig.java   
 * @Package com.platform.config   
 * @Description: (用一句话描述该文件做什么)   
 * @author: <a href="mailto:15909910367@163.com">吴先生</a> 
 * @date:   2021年12月14日 下午12:10:51   
 * @version V1.0 
 * @Copyright: 2021 吴先生.
 */
package com.platform.config;

import java.util.concurrent.ThreadPoolExecutor;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

/**   
 * @ClassName:  ThreadPoolConfig   
 * @Description:(这里用一句话描述这个类的作用)   
 * @author: <a href="mailto:15909910367@163.com">吴先生</a>  
 * @date:   2021年12月14日 下午12:10:51   
 *     
 * @Copyright: 2021 吴元森.  
 */
@Configuration
public class ThreadPoolConfig {

	@Bean
	public ThreadPoolTaskExecutor threadPool() {
		ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
		executor.setCorePoolSize(8);
		executor.setMaxPoolSize(16);
		executor.setQueueCapacity(8);
		executor.setThreadNamePrefix("manager-service-threadPool-");
		executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
		executor.setKeepAliveSeconds(60);
		executor.initialize();
		return executor;
	}
}